1. Field of the Invention
Apparatuses and methods consistent with the present invention relate to processing flash memory data. More particularly, the present invention relates to an apparatus and a method for processing data of a flash memory that is capable of easily determining the validity of the data.
2. Description of Related Arts
As a storage medium to store and process data, non-volatile memories are frequently used in embedded systems such as home electronic appliances, communication apparatuses and set-top boxes.
Among the non-volatile memories, flash memories are mainly used. A flash memory is a non-volatile storage device capable of electrically writing, rewriting and deleting data. As compared to a storage medium based on a magnetic disk, the flash memory needs less power and its access time is the same as a hard disk. Further, since the flash memory is compact in size, it is suitable for portable devices.
To rewrite data that was recorded in flash memory, it is necessary to delete the whole block in which the concerned data is recorded since the flash memory is a hardware unit.
Inconsistent units of writing and deleting data on the flash memory may degrade performance thereof. To prevent this degradation, a logical address and physical address concept was introduced.
The logical address refers to an address used when a user conducts a predetermined data operation on a flash memory through a predetermined user program, and the physical address refers to an address used when the predetermined data operation is actually conducted in the flash memory.
Generally, flash memory is classified into small block flash memory and large block flash memory. In the small block flash memory, a logical operation unit and a physical operation unit are identical, whereas the physical operation unit is larger than the logical operation unit in the large block flash memory.
FIGS. 1A and 1B illustrate schematic constructions of general small block flash memory and large block flash memory.
In a small block flash memory, a sector 11, which is a logical operation unit, is identical to a page 12, which is a physical operation unit, as illustrated in FIG. 1A.
In a large block flash memory, a page 22 is formed by collecting at least one sector, as illustrated in FIG. 1B.
A flash memory-based system may suffer from unexpected interruption of power supply because of an inherent property in an application field thereof. Accordingly, it is necessary to provide for interruption of the power supply while the flash memory is in operation.
Specifically, two cases where predetermined data is written in a flash memory and deleted from the flash memory will be described. When the power supply is interrupted while predetermined data is being written in a flash memory, a part of the data is written in the flash memory, but another part thereof may not be written. When the power supply is interrupted while predetermined data is being deleted from the flash memory, a part of the data is deleted from the flash memory, but another part thereof may not be deleted.
A variety of methods to determine the validity of flash memory data have been proposed in order to provide for unexpected interruption of the power supply before data operations such as writing or deleting are completed.
FIG. 2 illustrates data write operations in a flash memory according to the conventional art.
As illustrated therein, in order to write data in a predetermined sector of the flash memory, it is first determined whether space is available in the relevant sector. When space is available, a write operation is conducted and at the same time a predetermined value is recorded in a predetermined index region corresponding to the sector in which the data is written (S10).
In detail, as illustrated in FIG. 3, a flash memory comprises a single block 34 consisting a plurality of pages 33, each page composed of data region 31 and an index region 32. The index region 32 may be further divided into a first index region 32a to indicate the progress of a write operation, and a second index region 32b to indicate the progress of a delete operation. At this time, a first value and a third value are recorded in the first index region 32a and the second index region 32b, respectively.
When the data region 31 consists of a plurality of sectors as illustrated in FIG. 4, the first index region 32a is constructed on a sector basis. The second index region 32b is also constructed on a sector basis.
When the write operation is completed (S20), a second value to indicate completion of the write operation is recorded in the first index region 32a (S30).
For example, as the write operation begins, a first value “0xFE” is recorded in the first index region 32a, and a third value “0x00” is recorded in the second index region 32b. When the write operation is finished, a second value “0xFC” is recorded in the first index region 32a. 
At this time, when the values recorded in the first index region 32a and the second index region 32b are initial values, for example, “0xFF,” it is determined that data writing is possible. As the case may be, even when the value of the data region 31 is “0xFF,” it is determined that data writing is possible. Specifically, when a delete operation is conducted in the flash memory, all the bits are changed to 1. Thus, when all the bits are 1, that is, “0xFF,” the flash memory becomes available for data writing.
FIG. 5 illustrates a method of determining the validity of data written through the write operation of FIG. 2.
As illustrated, it is first determined whether values recorded in the first index region 32a and the second index region 32b are normal (S40).
Specifically, when the values recorded in the first index region 32a and the second index region 32b refer to the second value described above, it is determined that the values recorded in the first and the second index regions 32a and 32b are normal.
If the values are determined to be normal, data written in the relevant sector is determined to be valid (S50). If not normal, they are determined to be not valid (S60).
However, the conventional method of determining the validity of data requires two write operations in order to determine the validity of data written in the relevant sector when writing the data. That is, a first write operation to record data in the data region and to record a first value in the first index region 32a and a third value in the second index region, and a second write operation to record the second value again in the first index region.
Since two write operations have to be conducted, this may cause degradation in the performance of the write operation.
In addition, when the power supply is interrupted while an operation to delete data from the flash memory is conducted, a part of the data is deleted from the data region 31 described above, but the values of the first and the second index regions 32a and 32b are not deleted. Thus, invalid data may be determined to be valid, through the values recorded in the first and the second index regions 32a and 32b. In other words, if power supply is interrupted while the delete operation is being conducted and valid data is recorded in the data region 31 as shown in FIG. 6A, the first value of the first index region 32a, “0xFC,” and the third value of the second index region 32b, “0x00,” remain unchanged, although the data of the data region 31 is not valid any longer as shown in FIG. 6B. For this reason, there is a problem where invalid data is determined to be valid.
Korean Unexamined Patent Publication No. 2004-0042478 discloses a flash memory, access apparatus and method using the flash memory which is capable of storing and updating mapping information of a delete operation, to thereby prevent generation of this error. However, this invention still has difficulty determining the validity of data when errors occur in the write operations to be conducted to update the mapping information.